home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / glibc108.gz / glibc108 / glibc-1.08.1 / time / Makefile < prev    next >
Makefile  |  1994-05-04  |  4KB  |  129 lines

  1. # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3.  
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public License as
  6. # published by the Free Software Foundation; either version 2 of the
  7. # License, or (at your option) any later version.
  8.  
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # Library General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with the GNU C Library; see the file COPYING.LIB.  If
  16. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. # Cambridge, MA 02139, USA.
  18.  
  19. #
  20. #    Makefile for time routines
  21. #
  22. subdir    := time
  23.  
  24. headers    := time.h sys/time.h sys/timeb.h
  25. distribute := tzfile.h private.h scheck.c ialloc.c emkdir.c yearistype
  26. extra-objs = scheck.o ialloc.o emkdir.o zonenames $(tzfiles:%=z.%)
  27.  
  28. routines    := offtime asctime clock ctime difftime gmtime    \
  29.            localtime mktime strftime time __tzset tzfile \
  30.            __gettod settod adjtime getitmr \
  31.            __getitmr __adjtime __settod \
  32.            __setitmr tzset gettod setitmr \
  33.            stime dysize timegm timelocal ftime
  34. aux        := syms-time
  35.  
  36. others    := ap zdump zic
  37. tests    := test_time clocktest
  38.  
  39. tzfiles := africa antarctica asia australasia europe northamerica \
  40.        southamerica etcetera factory systemv backward
  41. # pacificnew doesn't compile; if it is to be used, it should be included in
  42. # northamerica.
  43. distribute := $(distribute) $(tzfiles) leapseconds pacificnew
  44.  
  45. install := zic zdump
  46.  
  47. include ../Makeconfig    # Get objpfx defined so we can use it below.
  48.  
  49. # zonenames uses this variable.
  50. define nl
  51.  
  52.  
  53. endef
  54. include $(objpfx)zonenames
  55.  
  56. # Make these absolute file names.
  57. localtime-file := $(firstword $(filter /%,$(localtime-file)) \
  58.                   $(addprefix $(zonedir)/, \
  59.                       $(localtime-file)))
  60. posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
  61.                    $(addprefix $(zonedir)/, \
  62.                        $(posixrules-file)))
  63.  
  64. ifndef cross-compiling
  65. # Don't try to install the zoneinfo files since we can't run zic.
  66. install-others = $(addprefix $(zonedir)/,$(zonenames)) \
  67.          $(localtime-file) $(posixrules-file)
  68. endif
  69.  
  70. include ../Rules
  71.  
  72.  
  73. $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
  74. # Kludge alert: we use an implicit rule (in what we are generating here)
  75. # because that is the only way to tell Make that the one command builds all
  76. # the files.
  77.     (echo 'define $*-zones'                        ;\
  78.      awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^;\
  79.      echo 'endef'                            ;\
  80.      echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))'        ;\
  81.      echo 'ifdef $*-zones'                        ;\
  82.      echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \'    ;\
  83.      echo '$< $$(objpfx)zic leapseconds yearistype'            ;\
  84.      echo '    $$(tzcompile)'                        ;\
  85.      echo 'endif'                            ;\
  86.      echo 'zonenames := $$(zonenames) $$($*-zones)'            ;\
  87.     ) > $@.new
  88.     mv $@.new $@
  89. $(objpfx)zonenames: Makefile
  90.     (for file in $(tzfiles); do \
  91.        echo "include \$$(objpfx)z.$$file"; \
  92.      done) > $@.new
  93.     mv $@.new $@
  94.  
  95. .PHONY: echo-zonenames
  96. echo-zonenames: zonenames
  97.     @echo 'Known zones: $(zonenames)'
  98.  
  99.  
  100. # Although $(zonedir) gets compiled into zic, it is useful to always
  101. # specify it with -d on the command line so that it can be overridden on
  102. # the command line of `make install' (e.g., "make install prefix=/foo").
  103. zic-cmd = $(dir $(word 2,$^))$(notdir $(word 2,$^)) -d $(zonedir)
  104. define tzcompile
  105. $(zic-cmd) -L $(word 3,$^) -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
  106. endef
  107.  
  108. ifdef localtime
  109. $(localtime-file): $(zonedir)/$(localtime) $(objpfx)zic
  110.     $(zic-cmd) -l $(localtime)
  111. endif
  112. ifdef posixrules
  113. $(posixrules-file): $(zonedir)/$(posixrules) $(objpfx)zic
  114.     $(zic-cmd) -p $(posixrules)
  115. endif
  116.  
  117.  
  118. $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o $(objpfx)emkdir.o
  119.  
  120. $(objpfx)tzfile.o: tzfile.c; $(tz-cc)
  121. $(objpfx)zic.o: zic.c; $(tz-cc)
  122.  
  123. # Some versions of GNU make have a bug with backslashes in define directives.
  124. tz-cc = $(COMPILE.c) $(+gcc-nowarn) \
  125.          -DTZDIR='"$(zonedir)"' \
  126.          -DTZDEFAULT='"$(localtime-file)"' \
  127.          -DTZDEFRULES='"$(posixrules-file)"' \
  128.          $< $(OUTPUT_OPTION)
  129.